package com.tao.ifdemo2;

import java.util.Scanner;

public class IfDemo6 {
    public static void main(String[] args) {
        // 定义年限，月薪变量
        double year;
        double money;
        Scanner input = new Scanner(System.in);
        System.out.println("输入年限");
        year = input.nextDouble();
        System.out.println("输入月薪");
        money = input.nextDouble();
        // 定义年终奖金变量
        double yearBonus;
        // 判断
        if (year < 0 || money < 0) {
            System.err.println("输入有误");
            return;
        }
        if (year < 1 && money <= 8000 ) { // 不满1年且月薪不过8000
            yearBonus = money * 1;
            System.out.println("年终奖为: " + yearBonus);
        } else if (year < 1 && money > 8000) { // 不满1年且月薪过8000
            yearBonus = money * 1.2;
            System.out.println("年终奖为: " + yearBonus);
        } else if (year < 3 && money <= 15000) { // 不满3年且月薪不过15000
            yearBonus = money * 2;
            System.out.println("年终奖为: " + yearBonus);
        } else if (year < 3 && money > 15000) { // 不满3年且月薪过15000
            yearBonus = money * 3;
            System.out.println("年终奖为: " + yearBonus);
        } else if (year >= 3 && money <= 20000) { // 满3年且月薪不过20000
            yearBonus = money * 3;
            System.out.println("年终奖为: " + yearBonus);
        } else if (year >= 3 && money > 20000) { // 满3年且月薪过20000
            yearBonus = money * 4;
            System.out.println("年终奖为: " + yearBonus);
        }
    }
}
